package com.gec.controller;

import com.gec.common.RecognitionResult;
import com.gec.entity.*;
import com.gec.service.RecognitionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @ahthor: lxj
 * @date: 2024/4/8 23:33
 * @title: 控制层
 **/
@Api(tags = "控制器")
@RestController
@RequestMapping("/system/recognition")
public class RecognitionController {

    @Autowired
    RecognitionService recognitionService;


    @ApiOperation("识别")
    @GetMapping("/result")
    public RecognitionResult getResult(){

        List<Layer> openLayers = new ArrayList<>();
        List<Layer> closeLayers = new ArrayList<>();
        List<Goods> goodsList = new ArrayList<>();
        List<Stock> stockList = new ArrayList<>();

        // 添加虚拟数据
        openLayers.add(new Layer(1, 1000));
        openLayers.add(new Layer(2, 2000));

        closeLayers.add(new Layer(1, 900));
        closeLayers.add(new Layer(2, 1800));

        goodsList.add(new Goods("A001", 100));
        goodsList.add(new Goods("B001", 200));

        stockList.add(new Stock("A001", 1, 5));
        stockList.add(new Stock("B001", 2, 3));

        RecognitionResult result = this.recognitionService.recognition(openLayers, closeLayers, goodsList, stockList);

        return result;

    }

}
